aphakia/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
aphakia/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
aphakia/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
aphakia/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
aphakia/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
aphakia/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
aphakia/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
aphakia/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
aphakia/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
aphakia/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
aphakia/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
aphakia/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
aphakia/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
aphakia/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
aphakia/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
aphakia/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
aphakia/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
aphakia/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
aphakia/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
aphakia/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
aphakia/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
aphakia/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
aphakia/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
aphakia/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
aphakia/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
aphakia/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
aphakia/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
aphakia/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
aphakia/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
aphakia/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
aphakia/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
aphakia/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
aphakia/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
aphakia/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
aphakia/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
aphakia/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
aphakia/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
ascian/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
ascian/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
ascian/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
ascian/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
ascian/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
ascian/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
ascian/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
ascian/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
ascian/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
ascian/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
ascian/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
ascian/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
ascian/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
ascian/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
ascian/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
ascian/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
ascian/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
ascian/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
ascian/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
ascian/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
ascian/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
ascian/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
ascian/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
ascian/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
ascian/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
ascian/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
ascian/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
ascian/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
ascian/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
ascian/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
ascian/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
ascian/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
ascian/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
ascian/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
ascian/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
ascian/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
ascian/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
ascian/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
bolognese/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
bolognese/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
bolognese/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
bolognese/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
bolognese/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
bolognese/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
bolognese/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
bolognese/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
bolognese/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
bolognese/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
bolognese/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
bolognese/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
bolognese/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
bolognese/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
bolognese/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
bolognese/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
bolognese/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
bolognese/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
bolognese/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
bolognese/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
bolognese/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
bolognese/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
bolognese/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
bolognese/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
bolognese/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
bolognese/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
bolognese/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
bolognese/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
bolognese/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
bolognese/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
bolognese/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
bolognese/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
bolognese/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
bolognese/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
bolognese/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
bolognese/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
bolognese/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
breeze/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
breeze/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
breeze/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
breeze/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
breeze/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
breeze/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
breeze/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
breeze/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
breeze/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
breeze/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
breeze/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
breeze/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
breeze/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
breeze/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
breeze/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
breeze/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
breeze/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
breeze/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
breeze/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
breeze/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
breeze/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
breeze/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
breeze/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
breeze/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
breeze/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
breeze/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
breeze/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
breeze/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
breeze/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
breeze/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
breeze/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
breeze/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
breeze/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
breeze/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
breeze/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
breeze/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
breeze/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
breeze/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
celemin/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
celemin/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
celemin/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
celemin/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
celemin/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
celemin/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
celemin/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
celemin/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
celemin/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
celemin/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
celemin/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
celemin/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
celemin/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
celemin/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
celemin/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
celemin/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
celemin/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
celemin/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
celemin/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
celemin/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
celemin/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
celemin/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
celemin/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
celemin/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
celemin/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
celemin/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
celemin/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
celemin/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
celemin/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
celemin/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
celemin/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
celemin/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
celemin/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
celemin/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
celemin/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
celemin/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
celemin/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
celemin/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
coquilla/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
coquilla/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
coquilla/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
coquilla/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
coquilla/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
coquilla/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
coquilla/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
coquilla/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
coquilla/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
coquilla/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
coquilla/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
coquilla/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
coquilla/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
coquilla/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
coquilla/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
coquilla/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
coquilla/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
coquilla/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
coquilla/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
coquilla/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
coquilla/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
coquilla/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
coquilla/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
coquilla/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
coquilla/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
coquilla/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
coquilla/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
coquilla/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
coquilla/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
coquilla/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
coquilla/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
coquilla/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
coquilla/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
coquilla/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
coquilla/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
coquilla/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
coquilla/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
filasse/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
filasse/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
filasse/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
filasse/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
filasse/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
filasse/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
filasse/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
filasse/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
filasse/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
filasse/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
filasse/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
filasse/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
filasse/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
filasse/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
filasse/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
filasse/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
filasse/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
filasse/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
filasse/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
filasse/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
filasse/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
filasse/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
filasse/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
filasse/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
filasse/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
filasse/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
filasse/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
filasse/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
filasse/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
filasse/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
filasse/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
filasse/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
filasse/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
filasse/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
filasse/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
filasse/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
filasse/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
filasse/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
gradable/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
gradable/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
gradable/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
gradable/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
gradable/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
gradable/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
gradable/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
gradable/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
gradable/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
gradable/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
gradable/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
gradable/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
gradable/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
gradable/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
gradable/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
gradable/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
gradable/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
gradable/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
gradable/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
gradable/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
gradable/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
gradable/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
gradable/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
gradable/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
gradable/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
gradable/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
gradable/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
gradable/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
gradable/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
gradable/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
gradable/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
gradable/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
gradable/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
gradable/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
gradable/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
gradable/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
gradable/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
gradable/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
harbinger/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
harbinger/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
harbinger/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
harbinger/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
harbinger/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
harbinger/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
harbinger/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
harbinger/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
harbinger/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
harbinger/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
harbinger/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
harbinger/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
harbinger/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
harbinger/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
harbinger/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
harbinger/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
harbinger/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
harbinger/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
harbinger/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
harbinger/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
harbinger/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
harbinger/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
harbinger/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
harbinger/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
harbinger/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
harbinger/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
harbinger/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
harbinger/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
harbinger/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
harbinger/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
harbinger/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
harbinger/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
harbinger/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
harbinger/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
harbinger/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
harbinger/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
harbinger/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
kashima/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
kashima/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
kashima/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
kashima/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
kashima/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
kashima/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
kashima/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
kashima/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
kashima/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
kashima/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
kashima/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
kashima/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
kashima/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
kashima/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
kashima/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
kashima/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
kashima/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
kashima/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
kashima/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
kashima/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
kashima/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
kashima/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
kashima/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
kashima/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
kashima/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
kashima/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
kashima/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
kashima/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
kashima/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
kashima/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
kashima/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
kashima/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
kashima/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
kashima/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
kashima/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
kashima/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
kashima/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
kashima/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
knockdown/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
knockdown/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
knockdown/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
knockdown/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
knockdown/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
knockdown/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
knockdown/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
knockdown/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
knockdown/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
knockdown/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
knockdown/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
knockdown/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
knockdown/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
knockdown/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
knockdown/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
knockdown/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
knockdown/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
knockdown/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
knockdown/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
knockdown/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
knockdown/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
knockdown/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
knockdown/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
knockdown/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
knockdown/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
knockdown/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
knockdown/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
knockdown/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
knockdown/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
knockdown/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
knockdown/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
knockdown/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
knockdown/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
knockdown/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
knockdown/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
knockdown/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
knockdown/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
manful/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
manful/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
manful/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
manful/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
manful/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
manful/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
manful/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
manful/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
manful/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
manful/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
manful/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
manful/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
manful/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
manful/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
manful/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
manful/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
manful/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
manful/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
manful/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
manful/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
manful/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
manful/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
manful/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
manful/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
manful/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
manful/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
manful/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
manful/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
manful/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
manful/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
manful/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
manful/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
manful/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
manful/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
manful/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
manful/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
manful/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
manful/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
manful/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
manful/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
maximal/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
maximal/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
maximal/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
maximal/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
maximal/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
maximal/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
maximal/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
maximal/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
maximal/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
maximal/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
maximal/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
maximal/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
maximal/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
maximal/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
maximal/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
maximal/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
maximal/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
maximal/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
maximal/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
maximal/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
maximal/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
maximal/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
maximal/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
maximal/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
maximal/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
maximal/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
maximal/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
maximal/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
maximal/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
maximal/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
maximal/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
maximal/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
maximal/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
maximal/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
maximal/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
maximal/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
maximal/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
maximal/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
periclase/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
periclase/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
periclase/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
periclase/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
periclase/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
periclase/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
periclase/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
periclase/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
periclase/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
periclase/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
periclase/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
periclase/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
periclase/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
periclase/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
periclase/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
periclase/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
periclase/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
periclase/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
periclase/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
periclase/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
periclase/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
periclase/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
periclase/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
periclase/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
periclase/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
periclase/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
periclase/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
periclase/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
periclase/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
periclase/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
periclase/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
periclase/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
periclase/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
periclase/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
periclase/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
periclase/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
periclase/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
periclase/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
poesis/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
poesis/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
poesis/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
poesis/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
poesis/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
poesis/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
poesis/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
poesis/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
poesis/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
poesis/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
poesis/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
poesis/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
poesis/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
poesis/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
poesis/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
poesis/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
poesis/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
poesis/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
poesis/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
poesis/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
poesis/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
poesis/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
poesis/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
poesis/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
poesis/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
poesis/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
poesis/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
poesis/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
poesis/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
poesis/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
poesis/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
poesis/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
poesis/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
poesis/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
poesis/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
poesis/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
poesis/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
poesis/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
proton/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
proton/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
proton/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
proton/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
proton/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
proton/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
proton/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
proton/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
proton/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
proton/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
proton/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
proton/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
proton/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
proton/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
proton/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
proton/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
proton/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
proton/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
proton/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
proton/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
proton/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
proton/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
proton/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
proton/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
proton/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
proton/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
proton/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
proton/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
proton/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
proton/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
proton/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
proton/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
proton/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
proton/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
proton/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
proton/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
proton/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
proton/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
proton/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
proton/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
recedence/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
recedence/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
recedence/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
recedence/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
recedence/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
recedence/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
recedence/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
recedence/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
recedence/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
recedence/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
recedence/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
recedence/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
recedence/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
recedence/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
recedence/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
recedence/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
recedence/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
recedence/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
recedence/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
recedence/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
recedence/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
recedence/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
recedence/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
recedence/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
recedence/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
recedence/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
recedence/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
recedence/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
recedence/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
recedence/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
recedence/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
recedence/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
recedence/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
recedence/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
recedence/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
recedence/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
recedence/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
recedence/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
scram/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
scram/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
scram/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
scram/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
scram/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
scram/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
scram/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
scram/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
scram/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
scram/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
scram/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
scram/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
scram/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
scram/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
scram/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
scram/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
scram/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
scram/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
scram/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
scram/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
scram/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
scram/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
scram/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
scram/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
scram/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
scram/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
scram/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
scram/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
scram/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
scram/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
scram/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
scram/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
scram/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
scram/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
scram/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
scram/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
scram/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
scram/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
scram/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
scram/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
server/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
server/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
server/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
server/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
server/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
server/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
server/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
server/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
server/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
server/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
server/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
server/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
server/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
server/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
server/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
server/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
server/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
server/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
server/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
server/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
server/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
server/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
server/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
server/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
server/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
server/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
server/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
server/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
server/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
server/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
server/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
server/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
server/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
server/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
server/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
server/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
server/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
server/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
server/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
server/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
shrubbish/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
shrubbish/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
shrubbish/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
shrubbish/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
shrubbish/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
shrubbish/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
shrubbish/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
shrubbish/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
shrubbish/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
shrubbish/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
shrubbish/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
shrubbish/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
shrubbish/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
shrubbish/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
shrubbish/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
shrubbish/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
shrubbish/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
shrubbish/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
shrubbish/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
shrubbish/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
shrubbish/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
shrubbish/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
shrubbish/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
shrubbish/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
shrubbish/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
shrubbish/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
shrubbish/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
shrubbish/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
shrubbish/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
shrubbish/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
shrubbish/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
shrubbish/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
shrubbish/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
sultam/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
sultam/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
sultam/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
sultam/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
sultam/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
sultam/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
sultam/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
sultam/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
sultam/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
sultam/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
sultam/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
sultam/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
sultam/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
sultam/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
sultam/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
sultam/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
sultam/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
sultam/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
sultam/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
sultam/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
sultam/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
sultam/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
sultam/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
sultam/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
sultam/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
sultam/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
sultam/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
sultam/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
sultam/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
sultam/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
sultam/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
sultam/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
sultam/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
sultam/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
sultam/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
sultam/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
sultam/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
sultam/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
virtuoso/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
virtuoso/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
virtuoso/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
virtuoso/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
virtuoso/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
virtuoso/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
virtuoso/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
virtuoso/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
virtuoso/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
virtuoso/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
virtuoso/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
virtuoso/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
virtuoso/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
virtuoso/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
virtuoso/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
virtuoso/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
virtuoso/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
virtuoso/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
virtuoso/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
virtuoso/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
virtuoso/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
virtuoso/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
virtuoso/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
virtuoso/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
virtuoso/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
virtuoso/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
virtuoso/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
virtuoso/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
virtuoso/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
virtuoso/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
virtuoso/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
virtuoso/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
virtuoso/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
wherrit/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
wherrit/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
wherrit/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wherrit/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wherrit/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
wherrit/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
wherrit/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
wherrit/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
wherrit/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
wherrit/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
wherrit/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
wherrit/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
wherrit/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
wherrit/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
wherrit/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
wherrit/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
wherrit/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
wherrit/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
wherrit/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
wherrit/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
wherrit/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
wherrit/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
wherrit/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
wherrit/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
wherrit/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
wherrit/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
wherrit/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
wherrit/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
wherrit/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
wherrit/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
wherrit/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
wherrit/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
wherrit/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
wherrit/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
wherrit/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
wherrit/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
wherrit/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
winsome/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
winsome/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
winsome/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
winsome/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
winsome/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
winsome/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
winsome/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
winsome/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
winsome/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
winsome/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
winsome/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
winsome/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
winsome/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
winsome/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
winsome/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
winsome/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
winsome/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
winsome/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
winsome/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
winsome/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
winsome/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
winsome/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
winsome/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
winsome/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
winsome/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
winsome/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
winsome/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
winsome/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
winsome/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
winsome/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
winsome/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
winsome/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
winsome/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
winsome/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
winsome/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
winsome/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
winsome/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
winsome/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
wirelike/dark
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
wirelike/light
https://github.com/multitheftauto/multitheftauto/tree/master/MTA10_Server/mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
1 /*****************************************************************************
2 *
3 * PROJECT: Multi Theft Auto v1.0
4 * LICENSE: See LICENSE in the top level directory
5 * FILE: mods/deathmatch/logic/packets/CPickupHideShowPacket.cpp
6 * PURPOSE: Pickup hide/show packet class
7 * DEVELOPERS: Christian Myhre Lundheim <>
8 * Jax <>
9 *
10 * Multi Theft Auto is available from http://www.multitheftauto.com/
11 *
12 *****************************************************************************/
13
14 #include "StdInc.h"
15
16 bool CPickupHideShowPacket::Write ( NetBitStreamInterface& BitStream )
const
17 {
18 // Got more than zero pickups added?
19 if ( m_List.size () >
0 )
20 {
21 // Write the flags
22 BitStream.WriteBit ( m_bShow );
23
24 // Write the pickup ids
25 unsigned short usPickupModelID;
26 CPickup* pPickup;
27 vector < CPickup* > ::const_iterator iter = m_List.begin ();
28 for ( ; iter != m_List.end (); iter++ )
29 {
30 pPickup = *iter;
31 usPickupModelID =
0;
32
33 // Grab the pickup type and set the pickup model id using it
34 unsigned char ucPickupType = pPickup->GetPickupType ();
35 switch ( ucPickupType )
36 {
37 case CPickup::HEALTH: usPickupModelID =
1240;
break;
38 case CPickup::ARMOR: usPickupModelID =
1242;
break;
39 case CPickup::WEAPON: usPickupModelID = CPickupManager::GetWeaponModel ( pPickup->GetWeaponType () );
break;
40 case CPickup::CUSTOM: usPickupModelID = pPickup->GetModel ();
break;
41 default:
break;
42 }
43
44 // Is the pickup model valid?
45 if ( usPickupModelID !=
0 )
46 {
47 // Write the pickup model id and id
48 BitStream.WriteCompressed ( pPickup->GetID () );
49 BitStream.WriteCompressed ( usPickupModelID );
50 }
51 }
52
53 return true;
54 }
55
56 return false;
57 }
wirelike/dark
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wirelike/light
https://github.com/mirrors/linux-2.6/tree/master/drivers/media/rc/keymaps/rc-pinnacle-grey.c
1 /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller
2 *
3 * keymap imported from ir-keymaps.c
4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13 #include <media/rc-map.h>
14
15 static struct rc_map_table pinnacle_grey[] = {
16 { 0x3a, KEY_0 },
17 { 0x31, KEY_1 },
18 { 0x32, KEY_2 },
19 { 0x33, KEY_3 },
20 { 0x34, KEY_4 },
21 { 0x35, KEY_5 },
22 { 0x36, KEY_6 },
23 { 0x37, KEY_7 },
24 { 0x38, KEY_8 },
25 { 0x39, KEY_9 },
26
27 { 0x2f, KEY_POWER },
28
29 { 0x2e, KEY_P },
30 { 0x1f, KEY_L },
31 { 0x2b, KEY_I },
32
33 { 0x2d, KEY_SCREEN },
34 { 0x1e, KEY_ZOOM },
35 { 0x1b, KEY_VOLUMEUP },
36 { 0x0f, KEY_VOLUMEDOWN },
37 { 0x17, KEY_CHANNELUP },
38 { 0x1c, KEY_CHANNELDOWN },
39 { 0x25, KEY_INFO },
40
41 { 0x3c, KEY_MUTE },
42
43 { 0x3d, KEY_LEFT },
44 { 0x3b, KEY_RIGHT },
45
46 { 0x3f, KEY_UP },
47 { 0x3e, KEY_DOWN },
48 { 0x1a, KEY_ENTER },
49
50 { 0x1d, KEY_MENU },
51 { 0x19, KEY_AGAIN },
52 { 0x16, KEY_PREVIOUSSONG },
53 { 0x13, KEY_NEXTSONG },
54 { 0x15, KEY_PAUSE },
55 { 0x0e, KEY_REWIND },
56 { 0x0d, KEY_PLAY },
57 { 0x0b, KEY_STOP },
58 { 0x07, KEY_FORWARD },
59 { 0x27, KEY_RECORD },
60 { 0x26, KEY_TUNER },
61 { 0x29, KEY_TEXT },
62 { 0x2a, KEY_MEDIA },
63 { 0x18, KEY_EPG },
64 };
65
66 static struct rc_map_list pinnacle_grey_map = {
67 .map = {
68 .scan = pinnacle_grey,
69 .size = ARRAY_SIZE(pinnacle_grey),
70 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
71 .name = RC_MAP_PINNACLE_GREY,
72 }
73 };
74
75 static int __init init_rc_map_pinnacle_grey(void)
76 {
77 return rc_map_register(&pinnacle_grey_map);
78 }
79
80 static void __exit exit_rc_map_pinnacle_grey(void)
81 {
82 rc_map_unregister(&pinnacle_grey_map);
83 }
84
85 module_init(init_rc_map_pinnacle_grey)
86 module_exit(exit_rc_map_pinnacle_grey)
87
88 MODULE_LICENSE("GPL");
89 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wirelike/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
wirelike/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH480/Fixture.cs
1 using System;
2 using System.Globalization;
3 using System.Threading;
4 using NHibernate.Cfg;
5 using NHibernate.Properties;
6 using NUnit.Framework;
7
8 namespace NHibernate.Test.NHSpecificTest.NH480
9 {
10 /// <summary>
11 /// This fixture is run in a Turkish locale because Turkish has special casing
12 /// rules for I and i.
13 /// </summary>
14 /// <remarks>
15 /// The rules are as follows:
16 /// <list>
17 /// <item>I (uppercase dotless i) is mapped to dotless lowercase i by ToLower</item>
18 /// <item>Lowercase i with a dot is mapped to uppercase I with a dot above by ToUpper</item>
19 /// </list>
20 /// This test checks that field naming strategies handle this correctly.
21 /// </remarks>
22 /// </summary>
23 [TestFixture]
24 public class Fixture
25 {
26 private CultureInfo currentCulture = null;
27 private CultureInfo currentUICulture = null;
28
29 [TestFixtureSetUp]
30 public void TestFixtureSetUp()
31 {
32 currentCulture = Thread.CurrentThread.CurrentCulture;
33 currentUICulture = Thread.CurrentThread.CurrentUICulture;
34
35 CultureInfo turkish = new CultureInfo("tr-TR");
36 Thread.CurrentThread.CurrentCulture = turkish;
37 Thread.CurrentThread.CurrentUICulture = turkish;
38 }
39
40 [TestFixtureTearDown]
41 public void TestFixtureTearDown()
42 {
43 Thread.CurrentThread.CurrentCulture = currentCulture;
44 Thread.CurrentThread.CurrentUICulture = currentUICulture;
45 }
46
47 [Test]
48 public void CheckIII()
49 {
50 Assert.AreEqual("iii", new CamelCaseStrategy().GetFieldName("Iii"));
51 Assert.AreEqual("_iii", new CamelCaseUnderscoreStrategy().GetFieldName("Iii"));
52
53 Assert.AreEqual("iii", new LowerCaseStrategy().GetFieldName("III"));
54 Assert.AreEqual("_iii", new LowerCaseUnderscoreStrategy().GetFieldName("III"));
55
56 Assert.AreEqual("m_Iii", new PascalCaseMUnderscoreStrategy().GetFieldName("iii"));
57 Assert.AreEqual("_Iii", new PascalCaseUnderscoreStrategy().GetFieldName("iii"));
58
59 Assert.AreEqual("iii_iii_iii", ImprovedNamingStrategy.Instance.ColumnName("IiiIiiIii"));
60 }
61 }
62 }
wirelike/dark
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
wirelike/light
https://github.com/torvalds/linux/tree/master/drivers/staging/rtl8712/rtl8712_efuse.h
1 #ifndef __RTL8712_EFUSE_H__
2 #define __RTL8712_EFUSE_H__
3
4 #include "osdep_service.h"
5
6
7 #define _REPEAT_THRESHOLD_ 3
8
9 #define EFUSE_MAX_SIZE 512
10 #define EFUSE_MAP_MAX_SIZE 128
11
12 #define PGPKG_MAX_WORDS 4
13 #define PGPKT_DATA_SIZE 8 /* PGPKG_MAX_WORDS*2; BYTES sizeof(u8)*8*/
14 #define MAX_PGPKT_SIZE 9 /* 1 + PGPKT_DATA_SIZE; header + 2 * 4 words (BYTES)*/
15
16 #define GET_EFUSE_OFFSET(header) ((header & 0xF0) >> 4)
17 #define GET_EFUSE_WORD_EN(header) (header & 0x0F)
18 #define MAKE_EFUSE_HEADER(offset, word_en) (((offset & 0x0F) << 4) | \
19 (word_en & 0x0F))
20 /*--------------------------------------------------------------------------*/
21 struct PGPKT_STRUCT {
22 u8 offset;
23 u8 word_en;
24 u8 data[PGPKT_DATA_SIZE];
25 };
26 /*--------------------------------------------------------------------------*/
27 u8 r8712_efuse_reg_init(struct _adapter *padapter);
28 void r8712_efuse_reg_uninit(struct _adapter *padapter);
29 u16 r8712_efuse_get_current_size(struct _adapter *padapter);
30 int r8712_efuse_get_max_size(struct _adapter *padapter);
31 void r8712_efuse_change_max_size(struct _adapter *padapter);
32 u8 r8712_efuse_pg_packet_read(struct _adapter *padapter,
33 u8 offset, u8 *data);
34 u8 r8712_efuse_pg_packet_write(struct _adapter *padapter,
35 const u8 offset, const u8 word_en,
36 const u8 *data);
37 u8 r8712_efuse_access(struct _adapter *padapter, u8 bRead,
38 u16 start_addr, u16 cnts, u8 *data);
39 u8 r8712_efuse_map_read(struct _adapter *padapter, u16 addr,
40 u16 cnts, u8 *data);
41 u8 r8712_efuse_map_write(struct _adapter *padapter, u16 addr,
42 u16 cnts, u8 *data);
43 #endif
wirelike/dark
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
wirelike/light
https://github.com/nablaone/slime/tree/master/contrib/swank-indentation.lisp
1 (in-package :swank)
2
3 (defvar *application-hints-tables* '()
4 "A list of hash tables mapping symbols to indentation hints (lists
5 of symbols and numbers as per cl-indent.el). Applications can add hash
6 tables to the list to change the auto indentation slime sends to
7 emacs.")
8
9 (defun has-application-indentation-hint-p (symbol)
10 (let ((default (load-time-value (gensym))))
11 (dolist (table *application-hints-tables*)
12 (let ((indentation (gethash symbol table default)))
13 (unless (eq default indentation)
14 (return-from has-application-indentation-hint-p
15 (values indentation t))))))
16 (values nil nil))
17
18 (defun application-indentation-hint (symbol)
19 (let ((indentation (has-application-indentation-hint-p symbol)))
20 (labels ((walk (indentation-spec)
21 (etypecase indentation-spec
22 (null nil)
23 (number indentation-spec)
24 (symbol (string-downcase indentation-spec))
25 (cons (cons (walk (car indentation-spec))
26 (walk (cdr indentation-spec)))))))
27 (walk indentation))))
28
29 ;;; override swank version of this function
30 (defun symbol-indentation (symbol)
31 "Return a form describing the indentation of SYMBOL.
32
33 The form is to be used as the `common-lisp-indent-function' property
34 in Emacs."
35 (cond
36 ((has-application-indentation-hint-p symbol)
37 (application-indentation-hint symbol))
38 ((and (macro-function symbol)
39 (not (known-to-emacs-p symbol)))
40 (let ((arglist (arglist symbol)))
41 (etypecase arglist
42 ((member :not-available)
43 nil)
44 (list
45 (macro-indentation arglist)))))
46 (t nil)))
wirelike/dark
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/light
https://github.com/bbatsov/emacs-dev-kit/tree/master/vendor/magit/contrib/magit-simple-keys.el
1 ;;; magit-simple-keys.el --- simple keybindings for Magit
2
3 ;; Copyright (C) 2011 Ramkumar Ramachandra
4 ;;
5 ;; Magit is free software; you can redistribute it and/or modify it
6 ;; under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3, or (at your option)
8 ;; any later version.
9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23
24 ;;; Code:
25
26 (require 'magit)
27
28 (defvar magit-key-mode-mapping
29 '((logging magit-display-log
)
30 (running magit-shell-command
)
31 (fetching magit-fetch-current
)
32 (pushing magit-push
)
33 (pulling magit-pull
)
34 (branching magit-checkout
)
35 (tagging magit-tag
)
36 (stashing magit-stash
)
37 (merging magit-merge
)
38 (submodule magit-submodule-update
)))
39
40 (defun magit-key-mode-generate
(term mapping-function
)
41 "Generate alias for the key-group term"
42 (eval
43 `(defalias
',(intern (concat
"magit-key-mode-popup-" (symbol-name term
)))
44 mapping-function
)))
45
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g
)
48 (magit-key-mode-generate
(car g
) (cadr g
)))
49 magit-key-mode-mapping
)
50
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
wirelike/light
https://github.com/erlang/otp/tree/master/lib/common_test/test/ct_hooks_SUITE_data/cth/tests/ct_cth_prio_SUITE.erl
1 %%^M
2 %% %CopyrightBegin%^M
3 %%^M
4 %% Copyright Ericsson AB 2010-2011. All Rights Reserved.^M
5 %%^M
6 %% The contents of this file are subject to the Erlang Public License,^M
7 %% Version 1.1, (the "License"); you may not use this file except in^M
8 %% compliance with the License. You should have received a copy of the^M
9 %% Erlang Public License along with this software. If not, it can be^M
10 %% retrieved online at http://www.erlang.org/.^M
11 %%^M
12 %% Software distributed under the License is distributed on an "AS IS"^M
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See^M
14 %% the License for the specific language governing rights and limitations^M
15 %% under the License.^M
16 %%^M
17 %% %CopyrightEnd%^M
18 %%^M
19 ^M
20 -module(
ct_cth_prio_SUITE).^M
21 ^M
22 %% Note: This directive should only be used in test suites.^M
23 -compile(
export_all).^M
24 ^M
25 -include(
"ct.hrl").^M
26 ^M
27 suite()
->^M
28 (
[{timetrap,
{minutes,
10}},^M
29 {ct_hooks,
[{empty_cth,
[800],
800},^M
30 {prio_cth,
[1200]},
{prio_cth,
[1200,
1050],
1050}]}]).^M
31 ^M
32 %% Test server callback functions^M
33 init_per_suite(
Config)
->^M
34 [{ct_hooks,
[{empty_cth,
[700],
700},^M
35 {prio_cth,
[600,
600]},^M
36 {prio_cth,
[600,
200],
200}]}|Config].^M
37 ^M
38 end_per_suite(
_Config)
->^M
39 ok.^M
40 ^M
41 init_per_group(
_G,
Config)
->^M
42 [{ct_hooks,
[{empty_cth,
[600],
600},^M
43 {prio_cth,
[900,
900]},
{prio_cth,
[500,
900],
900}]}|Config].^M
44 ^M
45 end_per_group(
_G,
_Config)
->^M
46 ok.^M
47 ^M
48 init_per_testcase(
_TestCase,
Config)
->^M
49 Config.^M
50 ^M
51 end_per_testcase(
_TestCase,
_Config)
->^M
52 ok.^M
53 ^M
54 all()
->^M
55 [{group,
test_group}].^M
56 ^M
57 groups()
->^M
58 [{test_group,
[],
[test_case]}].^M
59 ^M
60 %% Test cases starts here.^M
61 test_case(
Config)
when is_list(
Config)
->^M
62 ok.^M
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
wirelike/light
https://github.com/erlang/otp/tree/master/lib/percept/src/percept.hrl
1 %%
2 %% %CopyrightBegin%
3 %%
4 %% Copyright Ericsson AB 2007-2010. All Rights Reserved.
5 %%
6 %% The contents of this file are subject to the Erlang Public License,
7 %% Version 1.1, (the "License"); you may not use this file except in
8 %% compliance with the License. You should have received a copy of the
9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19
20 -define(
seconds(
EndTs,
StartTs),
timer:now_diff(
EndTs,
StartTs)
/1000000).
21
22 %%% ------------------- %%%
23 %%% Type definitions %%%
24 %%% ------------------- %%%
25
26 -type timestamp() ::
{non_neg_integer(),
non_neg_integer(),
non_neg_integer()
}.
27 -type true_mfa() ::
{atom(),
atom(),
byte()
| list()
}.
28 -type state() ::
'active' | 'inactive'.
29 -type scheduler_id() ::
{'scheduler_id',
non_neg_integer()
}.
30
31 %%% ------------------- %%%
32 %%% Records %%%
33 %%% ------------------- %%%
34
35 -record(
activity,
{
36 timestamp ,
%:: timestamp() ,
37 id ,
%:: pid() | port() | scheduler_id(),
38 state = undefined ,
%:: state() | 'undefined',
39 where = undefined ,
%:: true_mfa() | 'undefined',
40 runnable_count = 0 %:: non_neg_integer()
41 }).
42
43 -record(
information,
{
44 id ,
%:: pid() | port(),
45 name = undefined ,
%:: atom() | string() | 'undefined',
46 entry = undefined ,
%:: true_mfa() | 'undefined',
47 start = undefined ,
%:: timestamp() | 'undefined',
48 stop = undefined ,
%:: timestamp() | 'undefined',
49 parent = undefined ,
%:: pid() | 'undefined',
50 children = [] %:: [pid()]
51 }).
52
wirelike/dark
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
wirelike/light
https://github.com/yi-editor/yi/tree/master/yi-contrib/src/Yi/Style/Misc.hs
1 module Yi.Style
.Misc (happyDeluxe, textExMachina)
where
2
3 import Data.Monoid
4
5 -- Have to import global Yi space to get access to Data.Prototype. That should
6 -- be split into a separate package.
7 import Yi
8
9 -- TextMate themes are available on the TM wiki:
10 -- http://wiki.macromates.com/Themes/UserSubmittedThemes
11
12 -- | Theme originally designed by Joseph Andrew Magnani for TextMate, and
13 -- redistributed with explicit permission. It is not usable in the vty UI.
14 happyDeluxe
:: Theme
15 happyDeluxe
= defaultTheme
`override` \super _
-> super
16 { modelineAttributes
= emptyAttributes
17 , tabBarAttributes
= emptyAttributes { foreground
= RGB
255 255 255 }
18 , baseAttributes
= emptyAttributes { foreground
= RGB
255 255 255, background
= RGB
14 19 30 }
19
20 , selectedStyle
= withBg (RGB
21 40 90)
21
22 , commentStyle
= withFg (RGB
53 73 124)
23 , keywordStyle
= withFg (RGB
254 144 6)
24 , numberStyle
= withFg (RGB
20 222 209)
25 , stringStyle
= withFg (RGB
253 102 249)
26 , typeStyle
= mempty
27 , operatorStyle
= mempty
28 , errorStyle
= withFg (RGB
252 45 7)
29 }
30
31 -- | Theme originally developed by Matthew Ratzloff for TextMate, and
32 -- redistributed with explicit permission. It is not usable in the vty UI.
33 textExMachina
:: Theme
34 textExMachina
= defaultTheme
`override` \super _
-> super
35 { modelineAttributes
= emptyAttributes { foreground
= black }
36 , tabBarAttributes
= emptyAttributes { foreground
= black }
37 , baseAttributes
= emptyAttributes { foreground
= RGB
230 230 230, background
= RGB
21 21 21 }
38
39 , selectedStyle
= withBg (RGB
102 102 102)
40
41 , commentStyle
= withFg (RGB
51 51 51)
42 , keywordStyle
= withFg (RGB
119 124 178)
43 , numberStyle
= withFg (RGB
174 129 255)
44 , stringStyle
= withFg (RGB
102 204 255)
45 , typeStyle
= withFg (RGB
174 129 255)
46 , variableStyle
= withFg (RGB
255 255 255)
47 , operatorStyle
= withFg (RGB
151 255 127)
48 }
wirelike/dark
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
wirelike/light
https://github.com/Bukkit/CraftBukkit/tree/master/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
1 package org.bukkit.craftbukkit.entity;
2
3 import net.minecraft.server.EntityFireball;
4 import net.minecraft.server.EntityLiving;
5
6 import org.bukkit.craftbukkit.CraftServer;
7 import org.bukkit.entity.Fireball;
8 import org.bukkit.entity.LivingEntity;
9 import org.bukkit.util.Vector;
10
11 public class CraftFireball extends AbstractProjectile implements Fireball {
12 public CraftFireball(CraftServer server, EntityFireball entity) {
13 super(server, entity);
14 }
15
16 @Override
17 public String toString() {
18 return "CraftFireball";
19 }
20
21 public float getYield() {
22 return ((EntityFireball) getHandle()).yield;
23 }
24
25 public boolean isIncendiary() {
26 return ((EntityFireball) getHandle()).isIncendiary;
27 }
28
29 public void setIsIncendiary(boolean isIncendiary) {
30 ((EntityFireball) getHandle()).isIncendiary = isIncendiary;
31 }
32
33 public void setYield(float yield) {
34 ((EntityFireball) getHandle()).yield = yield;
35 }
36
37 public LivingEntity getShooter() {
38 if (((EntityFireball) getHandle()).shooter != null) {
39 return (LivingEntity) ((EntityFireball) getHandle()).shooter.getBukkitEntity();
40 }
41
42 return null;
43
44 }
45
46 public void setShooter(LivingEntity shooter) {
47 if (shooter instanceof CraftLivingEntity) {
48 ((EntityFireball) getHandle()).shooter = (EntityLiving) ((CraftLivingEntity) shooter).entity;
49 }
50 }
51
52 public Vector getDirection() {
53 return new Vector(((EntityFireball) getHandle()).c, ((EntityFireball) getHandle()).d, ((EntityFireball) getHandle()).e);
54 }
55
56 public void setDirection(Vector direction) {
57 ((EntityFireball) getHandle()).setDirection(direction.getX(), direction.getY(), direction.getZ());
58 }
59 }
wirelike/dark
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
wirelike/light
https://github.com/joyent/node/tree/master/test/simple/test-script-static-context.js
1 // Copyright Joyent, Inc. and other Node contributors.
2 //
3 // Permission is hereby granted, free of charge, to any person obtaining a
4 // copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to permit
8 // persons to whom the Software is furnished to do so, subject to the
9 // following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included
12 // in all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 var common = require('../common');
23 var assert = require('assert');
24
25 var Script = require('vm').Script;
26
27 common.debug('run in a new empty context');
28 var context = Script.createContext();
29 var result = Script.runInContext('"passed";', context);
30 assert.equal('passed', result);
31
32 common.debug('create a new pre-populated context');
33 context = Script.createContext({'foo': 'bar', 'thing': 'lala'});
34 assert.equal('bar', context.foo);
35 assert.equal('lala', context.thing);
36
37 common.debug('test updating context');
38 result = Script.runInContext('var foo = 3;', context);
39 assert.equal(3, context.foo);
40 assert.equal('lala', context.thing);
wirelike/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
wirelike/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/NaoDemo/bodyGotoCenter.lua
1 module(..., package.seeall);
2
3 require('Body')
4 require('walk')
5 require('vector')
6 require('Config')
7 require('wcm')
8 require('gcm')
9
10 t0 = 0;
11 timeout = 10.0;
12
13 maxStep = 0.06;
14
15 rClose = 0.30;
16
17 tLost = 3.0;
18
19
20 function entry()
21 print(_NAME.." entry");
22
23 t0 = Body.get_time();
24 end
25
26 function update()
27 local t = Body.get_time();
28
29 ball = wcm.get_ball();
30 pose = wcm.get_pose();
31 ballGlobal = util.pose_global({ball.x, ball.y, 0}, {pose.x, pose.y, pose.a});
32 tBall = Body.get_time() - ball.t;
33
34 id = gcm.get_team_player_id();
35 role = gcm.get_team_role();
36 if id == 1 then
37 -- goalie
38 centerPosition = vector.new(wcm.get_goal_defend());
39 centerPosition[1] = centerPosition[1] - util.sign(centerPosition[1]) * .5;
40 -- face center
41 centerPosition[3] = math.atan2(centerPosition[2], 0 - centerPosition[1]);
42
43 -- use stricter thresholds
44 thAlign = 10*math.pi/180;
45 rClose = .1;
46 else
47 if (role == 2) then
48 -- defend
49 centerPosition = vector.new(wcm.get_goal_defend())/2.0;
50 elseif (role == 3) then
51 -- support
52 centerPosition = vector.zeros(3);
53 else
54 -- attack
55 centerPosition = vector.new(wcm.get_goal_attack())/2.0;
56 end
57 end
58
59 centerRelative = util.pose_relative(centerPosition, {pose.x, pose.y, pose.a});
60 rCenterRelative = math.sqrt(centerRelative[1]^2 + centerRelative[2]^2);
61
62 vx = maxStep * centerRelative[1]/rCenterRelative;
63 vy = maxStep * centerRelative[2]/rCenterRelative;
64 if id == 1 then
65 va = .2 * centerRelative[3];
66 else
67 va = .2 * math.atan2(centerRelative[2], centerRelative[1]);
68 end
69 walk.set_velocity(vx, vy, va);
70
71 ballR = math.sqrt(ball.x^2 + ball.y^2);
72 if (tBall < 1.0) then
73 return 'ballFound';
74 end
75 if ((t - t0 > 2.0) and (rCenterRelative < rClose)) then
76 return 'done';
77 end
78 if (t - t0 > timeout) then
79 return "timeout";
80 end
81 end
82
83 function exit()
84 end
85
wirelike/dark
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/Three20UINavigator/Sources/TTURLLiteral.m
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/private/TTURLLiteral.h"
18
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21
22
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTURLLiteral
27
28 @synthesize name = _name;
29
30
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 - (
void)dealloc {
33 TT_RELEASE_SAFELY(_name);
34
35 [
super dealloc];
36 }
37
38
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 - (
BOOL)match:(NSString*)text {
41 return [text isEqualToString:_name];
42 }
43
44
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 - (NSString*)convertPropertyOfObject:(
id)object {
47 return _name;
48 }
49
50
51 @end
wirelike/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTSplitViewController.h
1 //
2 // Copyright 2009-2011 Facebook
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #import "Three20UINavigator/TTNavigatorRootContainer.h"
18
19 @class TTNavigator;
20
21 /**
22 * A split view controller that implements the navigator root protocol.
23 *
24 * See the TTCatalog sample app for an example of this controller in action.
25 */
26 @interface TTSplitViewController : UISplitViewController <
27 UISplitViewControllerDelegate,
28 TTNavigatorRootContainer
29 > {
30 @private
31 TTNavigator* _leftNavigator;
32 TTNavigator* _rightNavigator;
33
34 UIBarButtonItem* _splitViewButton;
35 UIPopoverController* _popoverSplitController;
36 }
37
38 @property (nonatomic, readonly) TTNavigator* leftNavigator;
39 @property (nonatomic, readonly) TTNavigator* rightNavigator;
40 @property (nonatomic, retain) UIBarButtonItem* splitViewButton;
41 @property (nonatomic, retain) UIPopoverController* popoverSplitController;
42
43
44 /**
45 * Show/hide the button as the right-side navigator's root navigation item's left button.
46 */
47 - (
void)updateSplitViewButton;
48
49 @end
wirelike/dark
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
wirelike/light
https://github.com/mirrors/perl/tree/master/t/lib/common.pl
1 # This code is used by lib/charnames.t, lib/feature.t, lib/subs.t,
2 # lib/strict.t and lib/warnings.t
3 #
4 # On input, $::local_tests is the number of tests in the caller; or
5 # 'no_plan' if unknown, in which case it is the caller's responsibility
6 # to call cur_test() to find out how many this executed
7
8 BEGIN {
9 require './test.pl';
10 }
11
12 use Config;
13 use File::Path;
14 use File::Spec::Functions qw(catfile curdir rel2abs);
15
16 use strict;
17 use warnings;
18 my (undef, $file) = caller;
19 my ($pragma_name) = $file =~ /([A-Za-z_0-9]+)\.t$/
20 or die "Can't identify pragama to test from file name '$file'";
21
22 $| = 1;
23
24 my @prgs = () ;
25 my @w_files = () ;
26
27 if (@ARGV)
28 { print "ARGV = [@ARGV]\n" ;
29 @w_files = map { s#^#./lib/$pragma_name/#; $_ } @ARGV
30 }
31 else
32 { @w_files = sort glob(catfile(curdir(), "lib", $pragma_name, "*")) }
33
34 my $files = 0;
35 foreach my $file (@w_files) {
36
37 next if $file =~ /(~|\.orig|,v)$/;
38 next if $file =~ /perlio$/ && !(find PerlIO::Layer 'perlio');
39 next if -d $file;
40
41 open my $fh, '<', $file or die "Cannot open $file: $!\n" ;
42 my $line = 0;
43 while (<$fh>) {
44 $line++;
45 last if /^__END__/ ;
46 }
47
48 {
49 local $/ = undef;
50 $files++;
51 @prgs = (@prgs, $file, split "\n########\n", <$fh>) ;
52 }
53 close $fh;
54 }
55
56 $^X = rel2abs($^X);
57 my $tempdir = tempfile;
58
59 mkdir $tempdir, 0700 or die "Can't mkdir '$tempdir': $!";
60 chdir $tempdir or die die "Can't chdir '$tempdir': $!";
61 unshift @INC, '../../lib';
62 my $cleanup = 1;
63
64 END {
65 if ($cleanup) {
66 chdir '..' or die "Couldn't chdir .. for cleanup: $!";
67 rmtree($tempdir);
68 }
69 }
70
71 local $/ = undef;
72
73 my $tests = $::local_tests || 0;
74 $tests = scalar(@prgs)-$files + $tests if $tests !~ /\D/;
75 plan $tests; # If input is 'no_plan', pass it on unchanged
76
77 run_multiple_progs('../..', @prgs);
78
79 1;
wirelike/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
wirelike/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Log/Writer/Mock.php
1 <?php
2 /**
3 * Zend Framework
4 *
5 * LICENSE
6 *
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
14 *
15 * @category Zend
16 * @package Zend_Log
17 * @subpackage Writer
18 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 */
21
22 /**
23 * @namespace
24 */
25 namespace Zend\
Log\Writer;
26
27 /**
28 * @uses \Zend\Log\Writer\AbstractWriter
29 * @category Zend
30 * @package Zend_Log
31 * @subpackage Writer
32 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
34 */
35 class Mock
extends AbstractWriter
36 {
37 /**
38 * array of log events
39 *
40 * @var array
41 */
42 public $events = array();
43
44 /**
45 * shutdown called?
46 *
47 * @var boolean
48 */
49 public $shutdown = false;
50
51 /**
52 * Write a message to the log.
53 *
54 * @param array $event event data
55 * @return void
56 */
57 public function _write
($event)
58 {
59 $this->events
[] = $event;
60 }
61
62 /**
63 * Record shutdown
64 *
65 * @return void
66 */
67 public function shutdown
()
68 {
69 $this->shutdown
= true;
70 }
71
72 /**
73 * Create a new instance of Zend_Log_Writer_Mock
74 *
75 * @param array|\Zend\Config\Config $config
76 * @return \Zend\Log\Writer\Mock
77 */
78 static public function factory
($config = array())
79 {
80 return new self();
81 }
82 }
wirelike/dark
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
wirelike/light
https://github.com/django/django/tree/master/tests/regressiontests/localflavor/at/tests.py
1 from django.contrib.localflavor.at.forms import (ATZipCodeField, ATStateSelect,
2 ATSocialSecurityNumberField)
3
4 from django.test import SimpleTestCase
5
6
7 class ATLocalFlavorTests(SimpleTestCase):
8 def test_ATStateSelect(self):
9 f = ATStateSelect()
10 out = u'''<select name="bundesland">
11 <option value="BL">Burgenland</option>
12 <option value="KA">Carinthia</option>
13 <option value="NO">Lower Austria</option>
14 <option value="OO">Upper Austria</option>
15 <option value="SA">Salzburg</option>
16 <option value="ST">Styria</option>
17 <option value="TI">Tyrol</option>
18 <option value="VO">Vorarlberg</option>
19 <option value="WI" selected="selected">Vienna</option>
20 </select>'''
21 self.assertEqual(f.render('bundesland', 'WI'), out)
22
23 def test_ATZipCodeField(self):
24 error_format = [u'Enter a zip code in the format XXXX.']
25 valid = {
26 '1150': '1150',
27 '4020': '4020',
28 '8020': '8020',
29 }
30 invalid = {
31 '0000' : error_format,
32 '0123' : error_format,
33 '111222': error_format,
34 'eeffee': error_format,
35 }
36 self.assertFieldOutput(ATZipCodeField, valid, invalid)
37
38 def test_ATSocialSecurityNumberField(self):
39 error_format = [u'Enter a valid Austrian Social Security Number in XXXX XXXXXX format.']
40 valid = {
41 '1237 010180': '1237 010180',
42 }
43 invalid = {
44 '1237 010181': error_format,
45 '12370 010180': error_format,
46 }
47 self.assertFieldOutput(ATSocialSecurityNumberField, valid, invalid)
wirelike/dark
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
wirelike/light
https://github.com/rails/rails/tree/master/activesupport/lib/active_support/core_ext/time/marshal.rb
1 # Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are
2 # unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load
3 # methods so that utc instances can be flagged on dump, and coerced back to utc on load.
4 if !Marshal.load(Marshal.dump(Time.now.utc)).utc?
5 class Time
6 class << self
7 alias_method :_load_without_utc_flag, :_load
8 def _load(marshaled_time)
9 time = _load_without_utc_flag(marshaled_time)
10 time.instance_eval do
11 if defined?(@marshal_with_utc_coercion)
12 val = remove_instance_variable("@marshal_with_utc_coercion")
13 end
14 val ? utc : self
15 end
16 end
17 end
18
19 alias_method :_dump_without_utc_flag, :_dump
20 def _dump(*args)
21 obj = dup
22 obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
23 obj._dump_without_utc_flag(*args)
24 end
25 end
26 end
27
28 # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
29 # preserves utc_offset. Preserve zone also, even though it may not
30 # work in some edge cases.
31 if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
32 class Time
33 class << self
34 alias_method :_load_without_zone, :_load
35 def _load(marshaled_time)
36 time = _load_without_zone(marshaled_time)
37 time.instance_eval do
38 if zone = defined?(@_zone) && remove_instance_variable('@_zone')
39 ary = to_a
40 ary[0] += subsec if ary[0] == sec
41 ary[-1] = zone
42 utc? ? Time.utc(*ary) : Time.local(*ary)
43 else
44 self
45 end
46 end
47 end
48 end
49
50 alias_method :_dump_without_zone, :_dump
51 def _dump(*args)
52 obj = dup
53 obj.instance_variable_set('@_zone', zone)
54 obj._dump_without_zone(*args)
55 end
56 end
57 end
wirelike/dark
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
wirelike/light
https://github.com/harrah/xsbt/tree/master/launch/ResolveValues.scala
1 /* sbt -- Simple Build Tool
2 * Copyright 2009 Mark Harrah
3 */
4 package xsbt.boot
5
6 import Pre._
7 import java.io.{File, FileInputStream}
8 import java.util.Properties
9
10 object ResolveValues
11 {
12 def apply(conf: LaunchConfiguration): LaunchConfiguration = (new ResolveValues(conf))()
13 private def trim(s: String) = if(s eq null) None else notEmpty(s.trim)
14 private def notEmpty(s: String) = if(isEmpty(s)) None else Some(s)
15 private def readProperties(propertiesFile: File) =
16 {
17 val properties = new Properties
18 if(propertiesFile.exists)
19 Using( new FileInputStream(propertiesFile) )( properties.load )
20 properties
21 }
22 }
23
24 import ResolveValues.{readProperties, trim}
25 final class ResolveValues(conf: LaunchConfiguration)
26 {
27 private def propertiesFile = conf.boot.properties
28 private lazy val properties = readProperties(propertiesFile)
29 def apply(): LaunchConfiguration =
30 {
31 import conf._
32 val scalaVersion = resolve(conf.scalaVersion)
33 val appVersion = resolve(app.version)
34 val classifiers = resolveClassifiers(ivyConfiguration.classifiers)
35 withVersions(scalaVersion, appVersion, classifiers)
36 }
37 def resolveClassifiers(classifiers: Classifiers): Classifiers =
38 {
39 import ConfigurationParser.readIDs
40 // the added "" ensures that the main jars are retrieved
41 val scalaClassifiers = "" :: resolve(classifiers.forScala)
42 val appClassifiers = "" :: resolve(classifiers.app)
43 Classifiers(new Explicit(scalaClassifiers), new Explicit(appClassifiers))
44 }
45 def resolve[T](v: Value[T])(implicit read: String => T): T =
46 v match
47 {
48 case e: Explicit[t] => e.value
49 case i: Implicit[t] =>
50 trim(properties.getProperty(i.name)) map read orElse
51 i.default getOrElse
52 error("No " + i.name + " specified in " + propertiesFile)
53 }
54 }
wirelike/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
wirelike/light
https://github.com/higepon/mosh/tree/master/misc/scripts/gen-label.scm
1 (import (rnrs) (match) (except (mosh) make-instruction) (srfi :26))
2
3 (define ash bitwise-arithmetic-shift)
4
5 ;; same as Object::makeInt
6 (define (make-int i)
7 (+ (ash i 2) 1))
8
9 (define (make-instruction i)
10 (+ (ash i 5) 14))
11
12 (define (make-seq s e)
13 (let loop ([s s]
14 [ret '()])
15 (if (> s e)
16 (reverse ret)
17 (loop (+ s 1) (cons s ret)))))
18
19 (define (print-insn lst op)
20 (define (print x) (display x op) (newline op))
21 (format op "// Do not edit this file generated by ~a\n" (car (command-line)))
22 (format op "static void* dispatch_table[~d] = {\n" (make-instruction (length lst)))
23 (let ((insn-indexes (map make-instruction (make-seq 0 (- (length lst) 1)))))
24 (let loop ([i 0]
25 [lst lst])
26 (cond
27 [(null? lst)
28 '()]
29 [(memq i insn-indexes)
30 (format op "&&LABEL_~a,\n" (car lst))
31 (loop (+ i 1) (cdr lst))]
32 [else
33 (print "&&LABEL_DEFAULT,")
34 (loop (+ i 1) lst)])))
35 (print "};"))
36
37 (define (read-input name)
38 (with-input-from-file name
39 (lambda ()
40 (let loop ([obj (read)]
41 [ret '()])
42 (if (eof-object? obj)
43 (reverse ret)
44 (match obj
45 [('define-insn name n)
46 (loop (read) (cons name ret))]))))))
47
48 (let* ((names (cdr (command-line)))
49 (in-name (car names))
50 (out-name (cadr names)))
51 (when (file-exists? out-name) (delete-file out-name))
52 (let ((lst (read-input in-name)))
53 (call-with-output-file
54 out-name
55 (cut print-insn lst <>)))
56 0)
wirelike/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])
wirelike/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/program-resources.ss
1 #lang scheme/base
2
3
4 (require scheme/contract
5 scheme/class
6 (only-in scheme/list first second empty)
7 "collects/moby/runtime/stx.ss"
8 "compiler/helpers.ss"
9 "resource.ss")
10
11 ;; A program/resources consists of program source, and the set of named bitmaps
12 ;; associated to it.
13 ;; TODO: We may expand this definition to handle other resource types like music
14 ;; and other media.
15 (define-struct program/resources (program resources))
16
17
18 ;; program/resources->sexp: program/resources -> sexp
19 (define (program/resources->sexp a-program/resources)
20 (list (program->sexp (program/resources-program a-program/resources))
21 (map (lambda (a-resource)
22 (list (send a-resource get-name)
23 (send a-resource get-bytes)))
24 (program/resources-resources a-program/resources))))
25
26
27 ;; sexp->program/resources: sexp -> program/resources
28 (define (sexp->program/resources->sexp an-sexp)
29 (make-program/resources
30 (sexp->program (first an-sexp))
31 (map (lambda (resource-sexp)
32 (new named-bytes-resource%
33 [name (first resource-sexp)]
34 [bytes (second resource-sexp)]))
35 (second an-sexp))))
36
37
38
39 ;; program/resources-write-bitmaps!: program/resources path -> void
40 (define (program/resources-write-resources! a-program/resources dest-dir)
41 (for ([a-resource (program/resources-resources a-program/resources)])
42 (send a-resource save! dest-dir)))
43
44
45 (provide/contract [struct program/resources
46 ([program program?]
47 [resources (listof (is-a?/c resource<%>))])]
48
49 [program/resources->sexp
50 (program/resources? . -> . any)]
51
52 [program/resources-write-resources!
53 (program/resources? path-string? . -> . any)])